feat: flow inc query terminal metrics transport#8045
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces OutputMetrics and OutputWithMetrics to track and expose terminal metrics, such as region watermarks, from query results across the client, frontend, and gRPC layers. It updates the gRPC Flight stream handling to support interleaved metrics messages and adds new API methods to retrieve these metrics. A critical issue was identified in the client's stream processing where a valid RecordBatch could be dropped if a subsequent Metrics message is malformed; yielding the batch before processing the next message is recommended to prevent data loss.
evenyag
reviewed
Apr 29, 2026
killme2008
reviewed
Apr 30, 2026
fengjiachun
reviewed
Apr 30, 2026
fengjiachun
reviewed
Apr 30, 2026
evenyag
reviewed
Apr 30, 2026
evenyag
approved these changes
May 9, 2026
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Avoid routing Flow-specific query extensions through comma-separated hints so checkpoint JSON values remain intact over Flight. Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
665b034 to
4cef82b
Compare
Signed-off-by: discord9 <discord9@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
This PR wires terminal record-batch metrics through the Flight/client/Flow consumer path.
It builds on #8015, which introduced
RecordBatchMetrics.region_watermarksand query-side terminal metric collection.Changes
Metricsmessages.OutputWithMetrics/OutputMetricshelpers so callers can consume terminal metrics without breaking existingOutputAPIs.Scope
This PR is limited to terminal metrics transport and consumption:
src/servers/src/grpc/flight.rssrc/client/src/database.rssrc/flow/src/batching_mode/frontend_client.rsIt intentionally does not include later stale-cursor, incremental-after-seq, benchmark.
Compatibility
Existing client APIs (
sql,query,create,alter, etc.) continue to return plainOutput.Terminal metrics are opt-in through the new metrics-aware helper path.
Malformed terminal metrics are rejected as transport/parsing errors instead of being silently ignored.
Tests
cargo test -p client terminal_metrics --libcargo test -p flow query_with_terminal_metrics --libCoverage includes:
PR Checklist
Please convert it to a draft if some of the following conditions are not met.